package org.example.sbdemo.response;

import lombok.Data;

@Data
public class Response <T>{
    private T  data;
    private boolean success;
    private String errorMessage;

    public static <K> Response<K> newSuccess( K data) {
        Response<K> response = new Response<>();
        response.setData(data);
        response.setSuccess(true);
        return response;
    }

    public static Response<Void> newError(String errorMessage) {
        Response<Void> response = new Response<>();
        response.setSuccess(false);
        response.setErrorMessage(errorMessage);
        return response;
    }
}
